package com.shansun.event.redis

import com.redis.RedisClient
import com.redis.Publisher
import com.redis.Publish

/**
 * <p></p>
 * @author:     lanbo <br>
 * @version:    1.0  <br>
 * @date:   	2012-4-16
 */
object Pub {
	println("starting publishing service ..")
	val p = new Publisher(new RedisClient("localhost", 6379))
	p.start
	
	def publish(channel: String, message: String) = {
	    p ! Publish(channel, message)
	}
	
	def main(args: Array[String]) {
	    while(true) {
	    	publish("test", "hello redis")
	    	Thread.sleep(1000)
	    }
	}
}